<template>
  <div class="home-view">
    <!-- 顶部标题栏 -->
    <van-nav-bar title="设备管理系统" fixed placeholder safe-area-inset-top />

    <!-- 内容区域 -->
    <div class="content">
      <DeviceStatus v-if="activeTab === 'status'" />
      <DeviceConfig v-if="activeTab === 'config'" @change-tab="activeTab = $event" />
      <ImageUpload v-if="activeTab === 'upload'" />
    </div>

    <!-- 底部导航栏 -->
    <van-tabbar v-model="activeTab" active-color="#1989fa" fixed placeholder safe-area-inset-bottom>
      <van-tabbar-item name="status" icon="home-o">设备状态</van-tabbar-item>
      <van-tabbar-item name="config" icon="setting-o">设备配置</van-tabbar-item>
      <van-tabbar-item name="upload" icon="photo-o">图片上传</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
import { ref } from 'vue'
import DeviceStatus from '../components/DeviceStatus.vue'
import DeviceConfig from '../components/DeviceConfig.vue'
import ImageUpload from '../components/ImageUpload.vue'

export default {
  name: 'HomeView',
  components: {
    DeviceStatus,
    DeviceConfig,
    ImageUpload
  },
  setup() {
    const activeTab = ref('status')

    return {
      activeTab
    }
  }
}
</script>

<style scoped>
.home-view {
  padding-bottom: 60px;
}

.content {
  padding: 16px;
}
</style>